package com.hmall.common.dto;

import cn.itcast.pojo.ItemDoc;
import com.sun.glass.ui.delegate.MenuItemDelegate;
import org.bouncycastle.asn1.cmc.CMCObjectIdentifiers;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

//分页查询接口
@Component
@FeignClient("itemservice")
public interface ItemClient {
    @GetMapping("item/list")
    PageDTO<Item> findPage(@RequestParam("page") Integer pageNumber, @RequestParam("size") Integer pageSize) ;





   //根据id查询商品接口
    @GetMapping("/item/getById/{id}")
    Item getByid (@PathVariable(name = "id")Long id);




    /**
     * 远程调用更新库存
     * @param itemId
     * @param num
     */
    @PutMapping("/item/stock/{itemId}/{num}")
    void updateStock(@PathVariable("itemId") Long itemId,
                     @PathVariable("num") Integer num);

    /**
     * 远程调用恢复库存
     * @param itemId
     * @param num
     */
    @PutMapping("/item/restoreStock/{itemId}/{num}")
    void restoreStock(@PathVariable("itemId") Long itemId,
                      @PathVariable("num") Integer num);
}









